﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Model;
using System.Data;

namespace WZManageSystem
{
    public partial class Home : BasePage
    {
        //BLL.Materials mBll = new BLL.Materials();
        //BLL.Softwares sBll = new BLL.Softwares();
        //BLL.Notice nBll = new BLL.Notice();
        //int RowCount = 0;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                //BindWaitingList();
                //BindRpt();
            }
        }


        private void BindWaitingList()
        {
            //DataTable dt = new DataTable();
            //dt.Columns.Add("DisplayStr", typeof(string));

            //Dictionary<string, int> list = mBll.GetProgressingList(UserName, UserGroup.ToString(),UserRole,Department);

            //string item = string.Empty;
            //foreach (string key in list.Keys)
            //{
            //    int count = list[key];
            //    if (count == 0)
            //        continue;
            //    #region Swith判断
            //    switch (UserGroup)
            //    {
            //        case 1: //公司用户
            //            switch (key)
            //            {
            //                case "RuKuWaitingSP":
            //                    item = string.Format("<a href='WZManager/RuKu/WaitingSPList.aspx' target='mainFrame'>共有{0}个等待入库申请</a>", count);
            //                    break;
            //                case "RuKuRejectSP":
            //                    item = string.Format("<a href='WZManager/RuKu/RejectSPList.aspx' target='mainFrame'>共有{0}个退回入库申请</a>", count);
            //                    break;
            //                case "LingYongWaitingSP":
            //                    item = string.Format("<a href='WZManager/LingYong/WaitingSPList.aspx' target='mainFrame'>共有{0}个等待领用申请</a>", count);
            //                    break;
            //                case "BMWaitingSP":
            //                    item = string.Format("<a href='WZManager/LingYong/YYSPList.aspx' target='mainFrame'>共有{0}个物资领用审批</a>", count);
            //                    break;
            //                case "JZWaitingSP":
            //                    item = string.Format("<a href='WZManager/LingYong/YYSPList.aspx' target='mainFrame'>共有{0}个物资领用审批</a>", count);
            //                    break;
            //                case "LingYongRejectSP":
            //                    item = string.Format("<a href='WZManager/LingYong/RejectSPList.aspx' target='mainFrame'>共有{0}个退回领用申请</a>", count);
            //                    break;
            //                case "BaoFeiWaitingSP":
            //                    item = string.Format("<a href='WZManager/BaoFei/WaitingSPList.aspx' target='mainFrame'>共有{0}个等待报废申请</a>", count);
            //                    break;
            //                case "HQYBBFWaitingSP":
            //                    item = string.Format("<a href='WZManager/BaoFei/BFSPList.aspx' target='mainFrame'>共有{0}个物资报废审批</a>", count);
            //                    break;
            //                case "HQLDBFWaitingSP":
            //                    item = string.Format("<a href='WZManager/BaoFei/BFSPList.aspx' target='mainFrame'>共有{0}个物资报废审批</a>", count);
            //                    break;
            //                case "BFWaitingSP":
            //                    item = string.Format("<a href='WZManager/BaoFei/BFSPList.aspx' target='mainFrame'>共有{0}个物资报废审批</a>", count);
            //                    break;
            //                case "BaoFeiRejectSP":
            //                    item = string.Format("<a href=WZManager/BaoFei/RejectSPList.aspx' target='mainFrame'>共有{0}个退回报废申请</a>", count);
            //                    break;
            //                case "HardwarePendingList":
            //                    item = string.Format("<a href='YWManager/GongSi/HardwarePendingList.aspx' target='mainFrame'>共有{0}个等待硬件排障申请</a>", count);
            //                    break;
            //                case "HardwareConfirmList":
            //                    item = string.Format("<a href='YWManager/Hardware/ConfirmList.aspx' target='mainFrame'>共有{0}个确认硬件排障申请</a>", count);
            //                    break;
            //                case "SoftwarePendingList":
            //                    item = string.Format("<a href='YWManager/GongSi/SoftwarePendingList.aspx' target='mainFrame'>共有{0}个等待软件排障申请</a>", count);
            //                    break;
            //                case "SoftwareConfirmList":
            //                    item = string.Format("<a href='YWManager/Software/ConfirmList.aspx' target='mainFrame'>共有{0}个确认软件排障申请</a>", count);
            //                    break;
            //                case "SQBWaitingList":
            //                    item = string.Format("<a href='SQManager/WaitingList.aspx' target='mainFrame'>共有{0}个等待申请表</a>", count);
            //                    break;
            //                case "SQBRejectList":
            //                    item = string.Format("<a href='SQManager/RejectList.aspx' target='mainFrame'>共有{0}个退回申请表</a>", count);
            //                    break;
            //            }
            //            dt.Rows.Add(item);
            //            break;
            //        case 2: //运维人员
            //            switch (key)
            //            {
            //                case "WaitingList":
            //                    item = string.Format("<a href='YWManager/WaitingList.aspx' target='mainFrame'>共有{0}个待处理运维</a>", count);
            //                    break;
            //                case "WaitingConfirmList":
            //                    item = string.Format("<a href='YWManager/WaitingConfirmList.aspx' target='mainFrame'>共有{0}个等待用户确认运维</a>", count);
            //                    break;
            //            }
            //            dt.Rows.Add(item);
            //            break;
            //        case 3: //一般管理员
            //            switch (key)
            //            {
            //                case "RuKuList":
            //                    item = string.Format("<a href='WZManager/RuKu/WZRuKuList.aspx' target='mainFrame'>共有{0}个物资入库审批</a>", count);
            //                    break;
            //                case "LingYongWaitingSP":
            //                    item = string.Format("<a href='WZManager/LingYong/WaitingSPList.aspx' target='mainFrame'>共有{0}个等待领用申请</a>", count);
            //                    break;
            //                case "LingYongList":
            //                    item = string.Format("<a href='WZManager/LingYong/YYSPList.aspx' target='mainFrame'>共有{0}个物资领用审批</a>", count);
            //                    break;
            //                case "BaoFeiWaitingSP":
            //                    item = string.Format("<a href='WZManager/BaoFei/WaitingSPList.aspx' target='mainFrame'>共有{0}个等待报废申请</a>", count);
            //                    break;
            //                case "BaoFeiList":
            //                    item = string.Format("<a href='WZManager/BaoFei/BFSPList.aspx' target='mainFrame'>共有{0}个物资报废审批</a>", count);
            //                    break;
            //                case "HardwarePendingAdminList":
            //                    item = string.Format("<a href='YWManager/Hardware/PendingList.aspx' target='mainFrame'>共有{0}个硬件排障派单</a>", count);
            //                    break;
            //                case "HardwareConfirmList":
            //                    item = string.Format("<a href='YWManager/Hardware/ConfirmList.aspx' target='mainFrame'>共有{0}个硬件排障确认</a>", count);
            //                    break;
            //                case "SoftwarePendingAdminList":
            //                    item = string.Format("<a href='YWManager/Software/PendingList.aspx' target='mainFrame'>共有{0}个软件排障派单</a>", count);
            //                    break;
            //                case "SoftwareConfirmList":
            //                    item = string.Format("<a href='YWManager/Software/ConfirmList.aspx' target='mainFrame'>共有{0}个软件排障确认</a>", count);
            //                    break;
            //                case "WaitingList":
            //                    item = string.Format("<a href='YWManager/WaitingList.aspx' target='mainFrame'>共有{0}个待处理运维</a>", count);
            //                    break;
            //                case "WaitingConfirmList":
            //                    item = string.Format("<a href='YWManager/WaitingConfirmList.aspx' target='mainFrame'>共有{0}个等待用户确认运维</a>", count);
            //                    break;
            //                case "SQBSPList":
            //                    item = string.Format("<a href='SQManager/SQBSPList.aspx' target='mainFrame'>共有{0}个申请表审批</a>", count);
            //                    break;
            //            }
            //            dt.Rows.Add(item);
            //            break;
            //        case 4: //中级管理员
            //            switch (key)
            //            {
            //                case "RuKuList":
            //                    item = string.Format("<a href='WZManager/RuKu/WZRuKuList.aspx' target='mainFrame'>共有{0}个物资入库审批</a>", count);
            //                    break;
            //                case "LingYongList":
            //                    item = string.Format("<a href='WZManager/LingYong/YYSPList.aspx' target='mainFrame'>共有{0}个物资领用审批</a>", count);
            //                    break;
            //                case "BaoFeiList":
            //                    item = string.Format("<a href='WZManager/BaoFei/BFSPList.aspx' target='mainFrame'>共有{0}个物资报废审批</a>", count);
            //                    break;
            //                case "SQBSPList":
            //                    item = string.Format("<a href='SQManager/SQBSPList.aspx' target='mainFrame'>共有{0}个申请表审批</a>", count);
            //                    break;
            //            }
            //            dt.Rows.Add(item);
            //            break;
            //        case 5: //超级管理员
            //            switch (key)
            //            {
            //                case "RuKuList":
            //                    item = string.Format("<a href='WZManager/RuKu/WZRuKuList.aspx' target='mainFrame'>共有{0}个物资入库审批</a>", count);
            //                    break;
            //                case "LingYongList":
            //                    item = string.Format("<a href='WZManager/LingYong/YYSPList.aspx' target='mainFrame'>共有{0}个物资领用审批</a>", count);
            //                    break;
            //                case "LingYongWaitingSP":
            //                    item = string.Format("<a href='WZManager/LingYong/WaitingSPList.aspx' target='mainFrame'>共有{0}个等待领用申请</a>", count);
            //                    break;
            //                case "BaoFeiWaitingSP":
            //                    item = string.Format("<a href='WZManager/BaoFei/WaitingSPList.aspx' target='mainFrame'>共有{0}个等待报废申请</a>", count);
            //                    break;
            //                case "BaoFeiList":
            //                    item = string.Format("<a href='WZManager/BaoFei/BFSPList.aspx' target='mainFrame'>共有{0}个物资报废审批</a>", count);
            //                    break;
            //                case "HardwarePendingAdminList":
            //                    item = string.Format("<a href='YWManager/Hardware/PendingList.aspx' target='mainFrame'>共有{0}个硬件排障派单</a>", count);
            //                    break;
            //                case "HardwareConfirmList":
            //                    item = string.Format("<a href='YWManager/Hardware/ConfirmList.aspx' target='mainFrame'>共有{0}个硬件排障确认</a>", count);
            //                    break;
            //                case "SoftwarePendingAdminList":
            //                    item = string.Format("<a href='YWManager/Software/PendingList.aspx' target='mainFrame'>共有{0}个软件排障派单</a>", count);
            //                    break;
            //                case "SoftwareConfirmList":
            //                    item = string.Format("<a href='YWManager/Software/ConfirmList.aspx' target='mainFrame'>共有{0}个软件排障确认</a>", count);
            //                    break;
            //                case "SQBSPList":
            //                    item = string.Format("<a href='SQManager/SQBSPList.aspx' target='mainFrame'>共有{0}个申请表审批</a>", count);
            //                    break;
            //            }
            //            dt.Rows.Add(item);
            //            break;
            //    }
            //    #endregion

            //}
            //this.Rpt.DataSource = dt;
            //this.Rpt.DataBind();
        }


        private void BindRpt()
        {
            //DataTable dtSoftware = new DataTable();
            //dtSoftware = sBll.GetList(1, 99, "", ref RowCount);
            //SoftWareListDataTableConvert(ref dtSoftware);
            //this.rptSoftList.DataSource = dtSoftware;
            //this.rptSoftList.DataBind();


            //DataTable dtNotice = new DataTable();
            //dtNotice = nBll.GetList(1, 99, "", ref RowCount);
            //this.rptNotice.DataSource = dtNotice;
            //this.rptNotice.DataBind();
        }

        /// <summary>
        /// 软件列表 数据处理
        /// </summary>
        /// <param name="dt"></param>
        private void SoftWareListDataTableConvert(ref DataTable dt)
        {
            //if (dt != null)
            //{
            //    foreach (DataRow dr in dt.Rows)
            //    {
            //        dr["ServerFileName"] = BaseUrl + "SoftwareUpload/" + dr["ServerFileName"];
            //        dr.AcceptChanges();   
            //    }
            //}
        }
    }
}
